rec = [[0,-2,-7,0],
       [9,2,-6,2],
       [-4,1,-1,1],
       [-1,8,0,-2]]

def size(start_pos,end_pos):
    s = 0
    for x in range(start_pos[0],end_pos[0] + 1):
        for y in range(start_pos[1],end_pos[1] + 1):
            s += rec[x][y]
    return s

def trying():
    l = []
    for s_x in range(0,len(rec)):
        for s_y in range(0,len(rec[0])):
            for e_x in range(s_x+1,len(rec)):
                for e_y in range(s_y+1,len(rec[0])):
                    start_pos = (s_y,s_x)
                    end_pos = (e_y,e_x)
                    s = size(start_pos,end_pos)
                    l.append((start_pos,end_pos,s))
    return l
'''
def PK(l):
    max_index = 0
    for i in range(1,len(l)):
        if l[i] > l[max_index]:
            max_index = i
    return max_index
'''
def biggest(l):
    com = []
    for i in l:
        com.append(i[2])
    #return l[PK(com)]
    return max(com)
    
def main():
    l = trying()
#    print(l)
    print(biggest(l))
    
main()